<?php 
     session_start();


header('Content-Type:text/html;charset=utf-8');
include"conn.php";
if(isset($_POST['bt']) ){
$name=$_POST['name'];

$mima=$_POST['mima'];


$sql="SELECT * FROM `zhanghu` WHERE name='$name' and mima='$mima'";
 
 $res = mysql_query($sql);
 $rows=mysql_num_rows($res);
 
  if($rows==false){
	  
	  echo  "<script> alert ('用户名或者密码错误!');  window.location.href='login.php';</script>";
	  
	  }

else
{
	
  
    //  注册登陆成功的 admin 变量，并赋值 true
    $_SESSION["admin"] = true;
	
	echo  "<script> window.location.href='index.php';</script>";
	  
	}

}
else{
	
	
		  echo  "<script> alert ('用户名或者密码错误!');  window.location.href='login.php';</script>";
	  
	
	}








?>
